<?php

	class Continent extends Model{

		private $_ContinentId;
		private $_Name;

		function __construct($arrInitialValues = null){
			parent::__construct();

			if (isset($arrInitialValues['continent_id']))
				$this->setContinentId($arrInitialValues['continent_id']);
			else
				$this->setContinentId(0);

			if (isset($arrInitialValues['name']))
				$this->setName($arrInitialValues['name']);
			else
				$this->setName('');

		}
		
		public function setContinentId($value){
			$this->_ContinentId = $value;
		}
		
		public function getContinentId(){
			return $this->_ContinentId;
		}
		
		public function setName($value){
			$this->_Name = $value;
		}
		
		public function getName(){
			return $this->_Name;
		}

		public function getCountry(){
			$query = '
				SELECT *
				FROM continents
				WHERE continent_id = ' . $this->_ContinentId;
			
			str_replace(' ', "'", $query);
			$dbHelper = new DBHelper($query);
			$country = $dbHelper->getResult();
			if (empty($country))
				return array();

			return $country[0];
		}
	}
?>
